<?php
echo $form->label('backup',__('Select Backup : ',true));
echo $form->select('backup',$backup,NULL,array('div'=>false,'id'=>'backuplist'));
echo $form->button('<span class="ui-icon ui-icon-trash">x</span>',array('id'=>'delbutton','div'=>false,'class'=>'submit ui-widget ui-state-default ui-corner-all','style'=>'margin-left:10px'));

echo $form->create(NULL,array('class'=>'formedit'));
echo $form->hidden('id',array('value'=>$id));
echo $form->textarea('code',array('value'=>$config,'style'=>'height:650px;','id'=>'configcode'));
echo "<br/><center>";
echo $js->submit('Save & Backup',array('url'=>array('controller'=>'plugins','action'=>'saveconfigplugin'),'update'=>'#panelconfig'));
echo "</center>";
echo $form->end();

$js->get('#backuplist');
echo $js->event('change',
	$js->request(array('controller'=>'plugins','action'=>'selectBackup'),array('method'=>'post','dataExpression'=>true,'data'=>'{id:$("#mctemplatepluginId").val(),file:$("#backuplist").val()}','update'=>'#configcode','type'=>'json','success'=>'$("#configcode").val(data);'))
	);
	
$js->get('#delbutton');
echo $js->event('click',
	$js->request(array('controller'=>'plugins','action'=>'deleteBackup'),array('method'=>'post','dataExpression'=>true,'data'=>'{id:$("#mctemplatepluginId").val(),file:$("#backuplist").val()}','update'=>'#panelconfig','type'=>'json'))
	);

echo $this->Js->writeBuffer();
?>